<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<!-- 新 Bootstrap4 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">


<link rel="stylesheet" href="../../css/bootstrap-table.min.css">

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>

<!-- bootstrap.bundle.min.js 用于弹窗、提示、下拉菜单，包含了 popper.min.js -->
<script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>

<!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
<script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>



<script src="../../js/bootstrap-table.min.js"></script>

<script src="../../js/bootstrap-table-zh-CN.min.js"></script>
<body>
<!--a-->
<div class="modal fade" id="querysymoble">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">

            <!-- 模态框头部 -->
            <div class="modal-header">
                <h6 class="modal-title">您正在做的业务是：生产管理--工序物料设计--制定工序物料设计单</h6>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>

            <!-- 模态框主体 -->
            <div class="modal-body" style="background-color: darkgray;">
                <div style="border: 1px solid black;margin-top: 10px; background-color: white;display: flex;flex-direction: column">
                    <h5 style="text-align: center;margin-top: 20px">工序物料设计单</h5>
                    <div style="display: flex;">
                        <div  style="margin-left: 10%;width: 40%;" >工序单编号：<span id="check_designId"></span></div>
                        <div style="width: 40%;display: flex"><div style="width: 23%">设计人：</div><span id="check_designer"></span></div>
                    </div>
                    <div  style="display: flex;margin-top: 5px;">
                        <div  style="margin-left: 10%;width: 30%;" >产品名称：<span id="check_productName"></span></div>
                        <div  style="margin-left: 10%;width: 40%;" >产品编号：<span id="check_productId"></span></div>
                    </div>
                    <div style="display: flex;">
                        <table class="table-sm  table-bordered table-hover" id="checkcahngtab" style="margin-left: 10%;margin-top: 5px;text-align: center" border="1" cellpadding="0" cellspacing="0" width="80%;">
                            <tr  class="table-primary" style="color: white">
                                <td>工序序号</td>
                                <td>工序名称</td>
                                <td>工序编号</td>
                                <td>描述</td>
                                <td>工时数</td>
                                <td>工时单位</td>
                                <td>工时成本</td>
                                <td>工时成本小计（元）</td>
                                <td>审核</td>
                            </tr>
                        </table>
                    </div>
                    <div>
                        <div  style="display: flex;margin-top: 5px;" >
                            <div  style="margin-left: 10%;width: 30%;" >工时总成本：<span id="check_costPriceSum"></span></div>
                            <div  style="margin-left: 10%;width: 30%;" >物料总成本：<span id="check_moduleCostPriceSum"></span></div>
                        </div>
                        <div  style="display: flex;margin-top: 5px;">
                            <div  style="margin-left: 10%;width: 30%;" >审核人：<span id="check_checker"></span></div>
                            <div  style="margin-left: 10%;width: 40%;" >审核时间：<span id="check_checkTime"></span></div>
                        </div>
                        <div style="display: flex;">
                            <div style="margin-left:10%;margin-top: 5px;display: flex;width: 100%">
                                设计要求：
                                <span id="check_procedureDescribe"></span>
                            </div>
                        </div>
                        <div style="display: flex;margin-bottom: 30px;">
                            <label style="margin-left:10%;margin-top: 5px;display: flex;width: 100%">审核意见：<span id="check_checkSuggestion" ></span></label>
                        </div>
                        <input type="hidden" id="gx_id">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--查看-->
<div class="modal fade" id="chakanmodal">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">

            <!-- 模态框头部 -->
            <div class="modal-header">
                <h6 class="modal-title">您正在做的业务是：生产管理--工序物料设计--工序物料设计单审核
                </h6>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>

            <!-- 模态框主体 -->
            <div class="modal-body" style="background-color: white;height: 450px;">
                <div style="display: flex;margin-left: 5%;flex-direction: column">
                    <h5 style="text-align: center;margin-top: 20px">工序物料设计单</h5>
                    <div  style="display: flex;margin-top: 5px;margin-bottom: 3%">
                        <div  style="margin-left: 10%;width: 30%;" >工序名称：<span id="gxmc"></span></div>
                        <div  style="margin-left: 10%;width: 40%;" >编号：<span id="djr"></span></div>
                    </div>
                    <table class="table table-striped table-bordered table-hover" id="neibucheck_table" border="1" cellspacing="0" cellpadding="0" style="width:97%;text-align: center">
                        <thead>
                        <tr>
                            <td>序号</td>
                            <td>物料名称</td>
                            <td>物料编号</td>
                            <td>工序本数量</td>
                            <td>描述</td>
                            <td>单位</td>
                            <td>单价</td>
                            <td>小计</td>
                        </tr>
                        </thead>
                        <tbody id="sheji_tbody">

                        </tbody>
                    </table>
                    <input id="gx_parentId" type="hidden">
                </div>
            </div>
        </div>
    </div>
</div>

<div>
    <table id="change_tab">

    </table>
</div>



<script>
    $(function () {
        $("#change_tab").bootstrapTable({
            method: "post",
            contentType: "application/x-www-form-urlencoded;charset=utf-8",
            url: "/lc/querymaterdesyall",
            striped: true,
            pageNumber: 1,
            pagination: true,
            sidePagination: "server",
            pageSize: 5,
            pageList: [5, 8, 10],
            queryParams: function (parms) {
                return {
                    pageNumber: (parms.offset / parms.limit) + 1,
                    pageSize: parms.limit,
                }
            },
            columns: [
                {title: "工序设计单编号", field: "designId", align: "center",
                    formatter:function (value,row,index) {
                        var a1="<a href='#' data-toggle=\"modal\" data-target=\"#querysymoble\" onclick='queryall("+JSON.stringify(row)+")'>"+value+"</a>"
                        return a1;
                    }},
                {title: "产品编号", field: "productId", align: "center"},
                {title: "产品名称", field: "productName", align: "center"},
                {title: "设计人", field: "designer", align: "center"},
                {title: "登记时间", field: "registerTime", align: "center"},
                {title: "工时总成本", field: "costPriceSum", align: "center"},
                {title: "审核状态", field: "designModuleTag", align: "center",
                    formatter:function (value,row,index) {
                       if(value=='G002-1'){
                           return "<span class='text-info'>等待审核</span>"
                       }else if(value=='G002-2'){
                           return "<span class='text-success'>审核通过</span>"
                       }else{
                           return "<span class='text-danger'>审核不通过</span>"
                       }
                    }},
            ],
        })
    })
    
    function  queryall(v1) {
        $("#check_designId").text(v1.designId);
        $("#check_designer").text(v1.designer);
        $("#check_productName").text(v1.productName);
        $("#check_productId").text(v1.productId);
        $("#check_costPriceSum").text(v1.costPriceSum);
        $("#check_moduleCostPriceSum").text(v1.moduleCostPriceSum);
        $("#check_checker").text(v1.checker);
        $("#check_checkTime").text(v1.checkTime);
        $("#check_procedureDescribe").text(v1.procedureDescribe);
        $("#check_checkSuggestion").val(v1.checkSuggestion);
        $("#gx_id").val(v1.id)
        $(".sheng_tr").remove()

        $.ajax({
            type:"POST",
            data:"id="+v1.id,
            url:"/lc/queryByidcheckmingxi",
            success:function (dd) {
                $.each(dd,function (index,d) {
                    $("#checkcahngtab").append("<tr class='sheng_tr'>" +
                        "<td>" + d.detailsNumber + "</td>" +
                        "<td>" + d.procedureName + "</td>" +
                        "<td>" + d.procedureId + "</td>" +
                        "<td>"+d.id+"</td>" +
                        "<td>" + d.labourHourAmount + "</td>" +
                        "<td>" + d.amountUnit + "</td>" +
                        "<td>" + d.costPrice + "</td>" +
                        "<td>" + d.subtotal + "</td>" +
                        "<td><a href='#' onclick='shengheselect("+d.id+",$(this).parent().parent())'>查看</a></td>" +
                        "</tr>")
                })
            }
        })
    }

    function shengheselect(v2,z) {
        $("#gxmc").text(z.find(" td:eq(1)").text())
        $("#djr").text(z.find(" td:eq(3)").text())
        $(".chtr").remove();
        $.ajax({
            type:"POST",
            data:"id="+v2,
            url:"/lc/queryBymoduletrue",
            success:function (g1) {
                $.each(g1,function (index,g) {
                    $("#neibucheck_table").append("<tr class='chtr'>" +
                        "<td>"+g.detailsNumber+"</td>" +
                        "<td>"+g.productName+"</td>" +
                        "<td>"+g.productId+"</td>" +
                        "<td>"+g.amount+"</td>" +
                        "<td><input type='hidden' value='"+g.id+"'></td>" +
                        "<td>"+g.amountUnit+"</td>" +
                        "<td>"+g.costPrice+"</td>" +
                        "<td>"+g.subtotal+"</td>" +
                        "</tr>")
                })
                $("#chakanmodal").modal("show")
            }
        })
    }
</script>
</body>
</html>